def all_goods():
    goods={"可口可乐":2.5,"百事可乐":2.5,"冰红茶":3,"脉动":3.4,"果缤纷":3,"绿茶":3,"茉莉花茶":3,"尖叫":2.5}
    return goods
def show_goods():
    for x,y in all_goods().items():
        print(x,":",str(y)+"元")
def total(goods_dict):
    count=0
    for name,num in goods_dict.items():
        count+=total_money
    print("需要支付金额:",count,"元")
    def main():
        goods_dict={}

        print("饮品自动售货机")
        show_goods()
        print("输入q完成购买")
        while True:
            goods_name=input("请输入购物的商品：")
            if goods_name=='q':
                break
            if goods_name in[g_name for g_name in
    all_goods().keys()]:
                 goods_num=input("请输入购物数量：")
                 if goods_num.isdigit():
                    goods_dict[goods_name]=float(goods_num)
                 else:
                    print('商品数量不合法')
            else:print('请输入正确的商品名称')
        total(goods_dict)
     